package com.platform.service.impl;

import com.platform.cache.J2CacheUtils;
import com.platform.dao.TeamDao;
import com.platform.entity.TeamEntity;
import com.platform.service.TeamService;
import com.platform.util.Constants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * Service实现类
 *  推广管理:团队管理
 * @author lipengjun
 * @email 939961241@qq.com
 * @date 2019-02-02 18:01:31
 */
@Service("teamService")
public class TeamServiceImpl implements TeamService {
    @Autowired
    private TeamDao teamDao;

    @Override
    public TeamEntity queryObject(Long id) {
        return teamDao.queryObject(id);
    }

    @Override
    public List<TeamEntity> queryList(Map<String, Object> map) {
        return teamDao.queryList(map);
    }

    @Override
    public int queryTotal(Map<String, Object> map) {
        return teamDao.queryTotal(map);
    }

    @Override
    public int save(TeamEntity tTeam) {
        J2CacheUtils.clear(Constants.REDIS_TEAM_KEY);
        return teamDao.save(tTeam);
    }

    @Override
    public int update(TeamEntity tTeam) {
        J2CacheUtils.clear(Constants.REDIS_TEAM_KEY);
        return teamDao.update(tTeam);
    }

    @Override
    public int delete(Long id) {
        J2CacheUtils.clear(Constants.REDIS_TEAM_KEY);
        return teamDao.delete(id);
    }

    @Override
    public int deleteBatch(Long[] ids) {
        J2CacheUtils.clear(Constants.REDIS_TEAM_KEY);
        return teamDao.deleteBatch(ids);
    }
}
